dbmailer.php version 1.1 
by Norman Clarke norman@dontblink.com

READ THIS!!!

=== What this script does: ===

This script will allow you to make web forms that either save 
user input into a delimited file or email it to a specified address.
It performs a function similar to the well known formmail Perl 
script, but two main diferences:

1) fewer configuralble options :-(
2) allows saving stuff to a delimited file :-) 

You would use this script if you
 
1) want a PHP solution rather than a Perl one
2) need file support
3) like it better for some reason.

If you want formmail, you can find information on it at 

http://www.worldwidemart.com/scripts/readme/formmail.shtml

== What you need ==

This script has been tested with Apache on a Linux server, 
but should work on other platforms and webservers. It will work
with PHP versions 3 or 4 installed as a server module or as
a CGI. Please let me know if it does not work on your platform
or setup and I'll try to fix it.

== SETUP INFO ==

If your PHP is installed as a module (common for Apache) then this 
script can be anywhere in your document root. If PHP is installed
as a CGI, then put it in your cgi-bin and chmod it 0755:

cp dbmailer.php /home/httpd/cgi-bin
cd /home/httpd/cgi-bin
chmod 0755 dbmailer.php

Now open the dbmailer.php file in your favorite text editor (vim, right?!) 
and change some of the variables so that the script does what you want 
it to. They should be sufficiently documented in the program file.

Now you'll need to set up a form that uses the script. The form tag
should look like this:

<form action="/path/to/dbmailer.php" method="post">

You also will want the following fields in your form if you want this 
script to work nicely. 

* subject
  something like <input type="hidden" name="subject" value="my subject">
  works if you don't want your guests to be able to specify the subject,
  or else <input type="text" name="subject">if you do.

* action
  this has to be mail or file. if you specify 'mail' the message
  gets emailed to you, if you specify file it goes to a tab file, 
  and you need to specify filename and path
  try something like <input type="hidden" name="action" value="mail">
  if you don't specify anything, mail is used as the default, so you really
  don't have to put this form field in unless you're really proper.

* from
  the username in the header field.  
  try something like  <input type="hidden" name="from" value="www">
  'www' is used if you don't specify anything.
  you could also let your guests fill out this field so the email appears
  to come from them: <input type="text" name="from">

== Other setup issues ==

1)
If you receive a message saying "document contained no data" then your
PHP probably does not know where sendmail or qmail is and can't figure 
out what to do.
 
You can specify where your mailer program is in your PHP config file. 
This is usually /usr/lib/php3.ini (PHP3) or /usr/lib/php.ini 
(PHP4). The location of this file on your system may be different.  
Read through the file and find where to put the line. Restart your server
if necessary and you script should work.

2) 
You can change the name to whatever you want, it does not have
to be dbmailer.php. You can safely change it to ".php3" if that's what 
your server recognizes.
